package oop.ex2.enums;

import java.util.regex.Pattern;

public enum MethodEnum {

    STRING("^\\s*(String)\\s+([A-Za-z]+\\w*)[(](.*)[)]\\s*[{]\\s*$"),
    INT("^\\s*(int)"+STRING.getCommonRegex()),
    DOUBLE("^\\s*(double)"+STRING.getCommonRegex()),
    BOOLEAN("^\\s*(boolean)"+STRING.getCommonRegex()),
    CHAR("^\\s*(char)"+STRING.getCommonRegex()),
    VOID("^\\s*(void)"+STRING.getCommonRegex()),
    PARENTHESIS("\\(.*\\)$");
    
    private String commonRegex;
    private Pattern enumPattern;
    
    private MethodEnum(String regex) {
        this.enumPattern = Pattern.compile(regex);
        commonRegex = "\\s+([A-Za-z]+\\w*)[(](.*)[)]\\s*[{]\\s*$";
    }
    
    public Pattern getEnumPattern() {
        return enumPattern;
    }
    
    public String getCommonRegex() {
        return commonRegex;
    }
}
